<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0" />
    <title>美策平台</title>
    <link rel="icon" type="image/png" href="/img/icon.png">
    <link rel="stylesheet" type="text/css" href="../datepicker/jquery-ui.min.css">
    <link type="text/css" rel="stylesheet" href="../css/app.css"/>
    <link type="text/css" rel="stylesheet" href="../css/loginMobile.css"/>
    <link type="text/css" rel="stylesheet" href="../css/all.css"/>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <script src="../datepicker/jquery-ui.min.js"></script>
    <script type="text/javascript" src="/h5/js/all.js"></script>
</head>
<body id="Ibody">
<!--
	制作：陈道祥
	页面：公司信息
	更新：九哥
-->



<!-----------公司无工厂页面---------->
<div class="stepTwo" id="IstepThreeNoFactoryCompanyInfo">
    <div class="companyRemark">备注：方便你的客户找到你、招聘的员工找到你、了解你、信任你，图片尽量上传完善。让客户多了解自己，容易接单成功。细节决定成败，图片清晰。</div>

    <div class="companyHeadPanel">
        <div class="companyHeadOne" style="color:red;">*标识为必填项</div>
    </div>
    <div class="companyInfoSpace"></div>
    <div class="modelPanel">
        <div class="modelTile">法人信息 <span style="color:red;">*</span></div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入姓名" class="regCode changeStatus" id="realname" onkeyup="changeStatus($(this))">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
           <!-- <select class="bossInfoSex"
                    style="width:90%;background:0;" id="sex" onchange="changeStatus($(this))">
                <option value ="0">请选择性别</option>
                <option value ="1">男</option>
                <option value ="2">女</option>
            </select>-->
            <span class="bossInfoSex" id="sex">请选择性别</span>
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入手机号" maxlength="11"  class="regCode changeStatus" id="mobile" onkeyup="changeStatus($(this))">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入身份证号码"  maxlength="18"  class="regCode changeStatus" id="idcard" onkeyup="changeStatus($(this))">
        </div>




        <div class="bFileDiv" id="sfzzm" title="请上传身份证正面" bixu="true"></div>
        <div class="bFileDiv" id="sfzfm" title="请上传身份证反面" bixu="true"></div>

        <div class="bFileDiv" id="sfzsc" title="请上传身份证手持" bixu="true"></div>



    </div>
    <div class="companyInfoSpace"></div>
    <div class="modelPanel">
        <div class="modelTile">公司信息 <span style="color:red;">*</span></div>

        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <select class="bossInfoSex" onchange="changeInput()" style="width:90%;background:0;"
                    id="facType" placeholder="行业类型">
                <option value="0">请选择行业类型</option>
                <option value="2">服装</option>
                <option value="3">印花</option>
                <option value="4">绣花</option>
                <option value="5">水洗</option>
                <option value="6">修色</option>
                <option value="7">设备</option>
                <option value="8">箱包</option>
                <option value="9">鞋帽</option>
                <option value="10">手袋</option>
                <option value="11">面料</option>
                <option value="12">辅料</option>
                <option value="13">围巾</option>
                <option value="14">手套</option>
                <option value="15">窗帘</option>
                <option value="16">袜子</option>
                <option value="17">纺纱</option>
                <option value="18">染整</option>
            </select>
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入公司名称" class="regCode changeStatus" id="comName" onkeyup="changeStatus($(this))">
        </div>

        <div class="bossInfoDiv">
            <span style="color:#f6f6f6;">*</span>
            <input type="text" placeholder="请输入公司座机" class="regCode" id="comTel" onkeyup="changeNotStatus()">
        </div>


        <div class="bossInfoDiv">
            <span style="color:#f6f6f6;">*</span>
            <input type="text" placeholder="请输入公司传真" class="regCode" id="comFax" onkeyup="changeNotStatus()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请选择所在定位"
                   class="regCode changeStatus" id="comCity"
                   onchange="changeStatus($(this))">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入公司地址" class="regCode changeStatus"
                   id="comAddress" onkeyup="changeStatus($(this))">
        </div>
        <div class="bossInfoDiv">
            <span style="color:red;">*</span>
            <input type="text" placeholder="请输入公司规模(公司人数)" class="regCode changeStatus" id="scale" onkeyup="changeStatus($(this))">
        </div>
        <div class="bossInfoDiv">
            <span style="color:#f6f6f6;">*</span>
            <input type="text" placeholder="请输入公司销售额" class="regCode" id="totalSale" onkeyup="changeNotStatus()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:#f6f6f6;">*</span>
            <input type="text" placeholder="请输入年销售件数" class="regCode" id="yearSale" onkeyup="changeNotStatus()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:#f6f6f6;">*</span>
            <input type="text" placeholder="请输入送货车辆" class="regCode" id="truck" onkeyup="changeNotStatus()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:#f6f6f6;">*</span>
            <input type="number" placeholder="请输入合同履约率,满分100"  min="0" max="100"  class="regCode" id="pact" onkeyup="changeNotStatus()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:#f6f6f6;">*</span>
            <input type="number" placeholder="请输入客户满意度,满分100" min="0" max="100"  class="regCode" id="cusLike" onkeyup="changeNotStatus()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:#f6f6f6;">*</span>
            <input type="number" placeholder="请输入品质合格率,满分100"  min="0"  max="100"   class="regCode" id="quality" onkeyup="changeNotStatus()">
        </div>
        <div class="bossInfoDiv">
            <span style="color:#f6f6f6;">*</span>
            <input type="text" placeholder="请输入品牌" class="regCode" id="brand" onkeyup="changeNotStatus()">
        </div>
    </div>
    <div class="companyInfoSpace"></div>
    <div class="modelPanel">
        <div class="businessTitle">业务类型： <span style="color:red;">*</span></div>
        <div class="businessItemDiv" id="outType">
        </div>
        <div class="businessTitle">年龄段： <span style="color:red;">*</span></div>
        <div class="businessAgePanel">
            <div class="businessAge">
                <input type="text" class="businessAgeValue" id="ageStart" onkeyup="businessAge()">
                <span>岁</span>
            </div>
            <div class="businessAgeLine">--</div>
            <div class="businessAge">
                <input type="text" class="businessAgeValue" id="ageEnd" onkeyup="businessAge()">
                <span>岁</span>
            </div>
        </div>
        <div class="businessTitle">公司简介： <span style="color:red;">*</span></div>
        <div class="factoryIntroDiv">
            <textarea placeholder="详细介绍公司成长经历，方便业务了解彼此" class="factoryIntro" id="detail" onkeyup="businessVal($(this))"></textarea>
        </div>
    </div>
    <div class="companyInfoSpace"></div>
   <input type="hidden" id="position" value=""/>
    <div class="nextStepDiv">
        <!--<span class="prevStep" id="companyPre">上一步</span>-->
        <!--<span class="nextStep" id="companyNext">下一步</span>-->
        <span class="prevStep">返回</span>
        <span class="nextStep" onclick="setSave()">保存</span>
    </div>
</div>
<span id="outTypeSpan"></span>
<!-----------公司无工厂页面---------->





<!-----------提示信息---------->
<div id="pop">
    <div id="popMask"></div>
    <div id="popDetail">
    </div>
</div>
<!-----------提示信息---------->

<!-----------提示信息---------->
<div id="errMsg"></div>
<!-----------提示信息---------->
</body>
<!--
<link href="https://cdn.bootcss.com/framework7/1.6.5/css/framework7.ios.min.css" rel="stylesheet">
<link href="https://cdn.bootcss.com/framework7/1.6.5/css/framework7.ios.colors.min.css" rel="stylesheet">
-->
<link rel="stylesheet" type="text/css" href="/h5/mui/css/mui.min.css">
<link rel="stylesheet" type="text/css" href="/h5/mui/css/mui.picker.min.css">

<script type="text/javascript" src="/h5/mui/js/mui.min.js"></script>
<script type="text/javascript" src="/h5/mui/js/mui.picker.min.js"></script>
<script type="text/javascript" src="../js/app.js"></script>
<script type="text/javascript" src="../js/loginCom.js"></script>
<!---
<script type="text/javascript" src="../js/location.js"></script>
<script src="../js/citypicker/regionsObject2.js"></script>
<script src="../js/citypicker/cityPicker.js"></script>
-->
<script>
    var map=new MC.View.Smap();
    var pany=new MC.View.format();
    H5.TitleBar.create("基本信息");
    (function(){
        MC.UI.muiPopPicker.showSexSelect("#sex",function(){
            changeStatus($("#sex"));
        });

        getComInfo();
        changeInput();

        $('#comCity').on('click',function(){
            var position=$('#position').val();
            map.Select(function(json){
                console.log(json);
                $('#comCity').val(json.address);
              ///  $('#comAddress').val(json.address);
                $('#position').val(json.positionStr);
            },position);

        });

    })();

    /**
     * 设置保存
     * */
    function setSave(){
        var userInfo = cacheGet('userInfo'); //获取用户信息
        var comInfo = cacheGet('comInfo'); //获取企业资料
        console.log(userInfo);

        if (userInfo == 'undefined' || userInfo.token == 'undefined') {
            getErrMsg('没有登录！');
            return;
        }

        var realname = $('#realname').val();
        var sex = $('#sex').val();
        var mobile = $('#mobile').val();
        var idcard = $('#idcard').val();
        var sfzzm = $('#sfzzm').val();
        var sfzfm = $('#sfzfm').val();
        var sfzsc = $('#sfzsc').val();
        var comName = $('#comName').val();
        var comTel = $('#comTel').val();
        var comFax = $('#comFax').val();
        var comAddress = $('#comAddress').val();
        var comCity = $('#comCity').val();
        var cusLike = $('#cusLike').val();
        var quality = $('#quality').val();
        var pact = $('#pact').val();
        var scale = $('#scale').val();
        var totalSale = $('#totalSale').val();
        var yearSale = $('#yearSale').val();
        var truck = $('#truck').val();
        var brand = $('#brand').val();
        //业务类型
        var outTypeMin = $('#outTypeMin').val();
        var outTypeMax = $('#outTypeMax').val();
        var i, resOutType, outTypes = new Array(), outTypeStr = '', ageRange;
        $('.businessItemDiv span').each(function () {
            if ($(this).children().children().prop('checked')) {
                outTypes.push($(this).children().children().attr('data-id'));
            }
        })
        outTypeStr = outTypes.join('||');
        //console.log(outTypes,outTypeStr);
        var ageStart = $('#ageStart').val();
        var ageEnd = $('#ageEnd').val();
        var detail = $('#detail').val();
        var facType = $('#facType').val();
        if (facType == 0) {
            getErrMsg('工厂类型未选择！','');
            return;
        }
        if (realname == '') {
            getErrMsg('法人名称未填写！');
            return;
        }
        if (sex == 0) {
            getErrMsg('法人性别未填选！');
            return;
        }
        if (mobile == '') {
            getErrMsg('法人手机号码未填写！');
            return;
        }
        if (idcard == '') {
            getErrMsg('法人身份证号码未填写！');
            return;
        }
        if (sfzzm == '') {
            getErrMsg('法人身份证正面照未上传！');
            return;
        }
        if (sfzfm == '') {
            getErrMsg('法人身份证反面照未上传！');
            return;
        }
        if (sfzsc == '') {
            getErrMsg('法人身份证手持照未上传！');
            return;
        }
        if (comName == '') {
            getErrMsg('公司名称未填写！');
            return;
        }
        if (comAddress == '') {
            getErrMsg('公司地址未填写！');
            return;
        }
        if (comCity == '') {
            getErrMsg('公司所在地未填写！');
            return;
        }
        if (scale == '') {
            getErrMsg('公司规模量未填写！');
            return;
        }
        if (outTypeStr == '') {
            getErrMsg('业务类型未选择！');
            return;
        }
        if (ageStart == '' || ageEnd == '') {
            getErrMsg('年龄段未填写！');
            return;
        }
        
        
        if (cusLike>100) {
            getErrMsg('满意度填写错误！');
            return;
        }    
        if (quality>100) {
            getErrMsg('合格率填写错误！');
            return;
        }    
        if (pact>100) {
            getErrMsg('合同履约率填写错误！');
            return;
        }
        
        
        
        
        
        
        
        ageRange = ageStart + ',' + ageEnd;
        if (detail == '') {
            getErrMsg('公司介绍未填写！');
            return;
        }
        var param2 = {
            scale: scale,
            totalSale: totalSale,
            yearSale: yearSale,
            truck: truck,
            brand: brand
        };
        //var param2 = {
        //};
        var comInfoNew = {
            facType: facType,
            realname: realname,
            sex: sex,
            mobile: mobile,
            idcard: idcard,
            sfzzm: sfzzm,
            sfzfm: sfzfm,
            sfzsc: sfzsc,
            comName: comName,
            comTel: comTel,
            comFax: comFax,
            comAddress: comAddress,
            comCity: comCity,
            cusLike: cusLike,
            quality: quality,
            pact: pact,
            param: '',
            param2: param2,
            outTypeStr: outTypeStr,
            ageRange: ageRange,
            detail: detail,
            position:$('#position').val()
        };
        var data = {
            app_access: app_access,
            token: userInfo.token,
            type: userInfo.type,
            cate: userInfo.cate,
            comInfo: comInfoNew
        };
        cacheSet('comInfo', ''); //缓存企业资料
        //console.log(data); return;
        $.ajax({
            type: 'post',
            url: getDomain() + 'modify',
            data: data,
            success: function (res) {
                //console.log(res); return;
                if (res.code != 0) {
                    getAppErrMsg(res.msg,'',0);
                    console.log(res);
                    return;
                }
                getAppErrMsg('操作成功！','',0);
                window.location.href = '/h5/login/comList.html';
            },
            error: function () {
                getAppErrMsg('操作失败！','',0);
                console.log('操作失败！');
                return;
            }
        });
    }
    $('.prevStep').on('click', function () {
        cacheSet('comInfo', ''); //缓存企业资料清空
        history.go(-1)
    })
</script>
</html>